<?php
	/**
	 * 订单管理控制器
	 */
	class OrderAction extends CommonAction{

		//订单列表，所有订单信息都显示
		public function index(){

			$db = M('order');
			$this->orders = $db->select();
			$this->display();
		}

		//显示代付款的订单信息
		public function waitbuy(){
			$db = M('order');
			$this->orders = $db->where(array('status'=>1))->select();
			$this->display();
		}
		//显示待发货的订单信息
		public function waittogs(){
			if($this->isAjax()){
				 $oid = $_SESSION['oid'];
		        $db = M('order');
		        $result = $db->where(array('id'=>$oid))->save(array('status'=>3));
		        echo $result;
		        die;
			}
			$db = M('order');
			$this->orders = $db->where(array('status'=>2))->select();
			$this->display();
		}
		//显示已发货的订单信息
		public function gshvto(){
			if($this->isAjax()){
				 $oid = $_SESSION['oid'];
		        $db = M('order');
		        $result = $db->where(array('id'=>$oid))->save(array('status'=>4));
		        echo $result;
		        die;
			}
			$db = M('order');
			$this->orders = $db->where(array('status'=>3))->select();
			$this->display();
		}

		//显示已完成的订单信息
		public function orderok(){
			$db = M('order');
			$this->orders = $db->where(array('status'=>4))->select();
			$this->display();
		}
	}
?>